import { createRouter, createWebHistory } from 'vue-router'
import Layout from "@/layout/Layout";
import Login from "@/views/Login";
import Drug from "@/views/Drug";
import Medical from "@/views/Medical";
import MedicalAdd from "@/views/MedicalAdd";
import Patient from "@/views/Patient";
import GM from "@/views/GM";
//redirect 可以实现重定向
const routes = [
  {
    path: '/',
    name: 'Layout',
    component: Layout,
    redirect: '/login',
    children: [
        {
            path: 'drug',
            name: 'Drug',
            component: Drug,
        },
        {
            path: 'medical',
            name: 'Medical',
            component: Medical,
        },
        {
            path: 'medicaladd',
            name: 'MedicalAdd',
            component: MedicalAdd,
        },
        {
            path: 'patient',
            name: 'Patient',
            component: Patient,
        },
        {
            path: 'gm',
            name: 'GM',
            component: GM,
        }
    ]
  },
    {
        path: '/login',
        name: 'Login',
        component: Login,
    }

]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
